package com.jfl.config.swagger2;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * Swagger2 配置文件
 * 
 * @author 赵炎
 * @version [V1.00, 2018年11月29日]
 * @see [相关类/方法]
 * @since V1.00
 */
@Configuration
@EnableSwagger2
public class Swagger2Config
{
    
    @Bean
    public Docket platformApi()
    {
        return new Docket(DocumentationType.SWAGGER_2)
            .groupName("jfl-platform")
            .apiInfo(apiInfo())
            .select()
            .apis(RequestHandlerSelectors.basePackage("com.jfl.controller.sys"))
            .paths(PathSelectors.any())
            .build();
    }
    
    private ApiInfo apiInfo()
    {
        return new ApiInfoBuilder().title("JFL-RESTFUL-API")
            .description("©2018 Copyright. Powered By youxiaxiaomage.")
            .contact(new Contact("zhaoyan", "", "yanzhao_jn@163.com"))
            .license("Apache License Version 2.0")
            .licenseUrl("https://gitee.com/youxiaxiaomage/jfl-platform-parent")
            .version("2.0")
            .build();
    }
    
}
